package org.tigr.htc.cmd;

/*
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.

This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
*/

import org.apache.log4j.Logger;

/**
 * The <b>CommandStatus</b> class is a value object
 *
 */
public class CommandSetStatus extends CommandStatusImp {
    static private Logger log = Logger.getLogger(CommandSetStatus.class);
    protected CommandSet cmdSet;

    /**
     * Creates a new <code>CommandStatus</code> instance.
     *
     */
    public CommandSetStatus() {
        message = "";
        errors = 0;
        waiting = 0;
        completed = 0;
        running = 0;
        returnValue = 0;
    }

    /**
     * This constructor creates a new instance.
     *  
     * @param message
     * @param returnValue
     * @param errors
     * @param waiting
     * @param completed
     * @param interrupted
     * @param running
     */
    public CommandSetStatus(String message, int returnValue, int errors, int waiting,
			    int completed, int interrupted, int running) 
    {
        super();
        this.message = message;
        this.returnValue = returnValue;
        this.errors = errors;
        this.waiting = waiting;
        this.completed = completed;
        this.interrupted = interrupted;
        this.running = running;
    }

    /**
     * Describe <code>toString</code> method here.
     *
     * @return a <code>String</code> value
     */
    public String toString() {
    	return CommandHelper.getInstance().marshal(this);
    }

    //
    //  Getters and Setters
    //

    public CommandSet getCommandSet() {
    	log.debug("In getCommandSet: " + cmdSet.getID());
    	return this.cmdSet;
    }
    
    public void setCommandSet(CommandSet p_cmdSet) {
    	log.debug("In setCommandSet " + p_cmdSet.getID());
    	this.cmdSet = p_cmdSet;
    }

    public Object clone() {
        return new CommandSetStatus(message, returnValue, errors,waiting, 
				    completed, interrupted, running);
    }
}
